﻿using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class OrderList
{
    public string goodname;
    public float goodprice;
    /// <summary>
    /// 构造函数
    /// </summary>
    /// <param name="instruID"></param>
    /// <param name="quantity"></param>
    /// <return></return>
    public OrderList(DataTable good)
    {
        this.instruID = (int)good.Rows[0]["instruID"];
        this.goodname = (string)good.Rows[0]["name"];
        this.goodprice= (float)good.Rows[0]["sellPrice"];
        this.quantity = 1;
    }
    /// <summary>
    /// 获得订单的购物清单
    /// </summary>
    /// <param name="orderid"></param>
    /// <returns></returns>
    public DataTable GetOrderListByOrderID(int orderID)
    {
        DataModelDataContext data = new DataModelDataContext();
        var result = data.Pr_GetOrderListByOrderID(orderID);
        DataTable table = new DataTable();
        table = result.CopyToDataTable();
        return table;
    }

    /// <summary>
    /// 获得定单合计
    /// </summary>
    /// <param name="orderid"></param>
    /// <param name="kind"></param>
    /// <param name="money"></param>
    /// <param name="discount"></param>
    //public void GetOrderListByOrderID(int orderID, out int kind, out double money, out double discount)
    //{
    //    DataModelDataContext data = new DataModelDataContext();
    //    var result = data.Pr_GetOrderListByOrderID1(orderid);
    //    ///定义保存从数据库获取的结果的DataTable
    //    DataTable table = new DataTable();
    //    //把LINQ查询结果集转化为DataTable
    //    table = result.CopyToDataTable();
    //    if (table != null)
    //    {
    //        kind = Convert.ToInt32(table.Rows[0]["kindnum"].ToString());
    //        money = Convert.ToDouble(table.Rows[0]["moneysum"].ToString());
    //        discount = Convert.ToDouble(table.Rows[0]["moneydis"].ToString());
    //    }
    //    else
    //    {
    //        kind = 0;
    //        money = 0;
    //        discount = 0;
    //    }
    //}
}